package org.nepu.scr.indexrate.converter.longevityrate;

import cn.hutool.json.JSONUtil;
import org.nepu.scr.indexrate.vo.longevityrate.StrengthC51;

import javax.persistence.AttributeConverter;
import javax.persistence.Convert;

@Convert
public class StrengthC51Converter implements AttributeConverter<StrengthC51, String> {
    @Override
    public String convertToDatabaseColumn(StrengthC51 strengthC51) {
        return JSONUtil.toJsonStr(strengthC51);
    }

    @Override
    public StrengthC51 convertToEntityAttribute(String s) {
        return JSONUtil.toBean(s, StrengthC51.class);
    }
}
